package swingson;

import com.swingson.SwingsonGui;
import com.swingson.SwingsonGuiBuilder;
import java.io.FileNotFoundException;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

/**
 *
 * @author sad
 */
public class SwingsonTestForm extends JFrame {

    public static void main(String[] args) throws FileNotFoundException {
        SwingsonGuiBuilder.setWindowsLookAndFeel();
        SwingsonGuiBuilder.addControl(MyPanel.class);
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    SwingsonTestForm form = new SwingsonTestForm();
                    form.pack();
                    form.setVisible(true);
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                }
            }
        });
    }

    private final SwingsonGui gui;

    public SwingsonTestForm() throws FileNotFoundException {
        gui = SwingsonGuiBuilder.createGuiFromJsonInPackage(this);
        gui.setVariable("buttonEnabled", true);
        gui.setVariable("panelVisibility", true);
        gui.setVariable("ngTextValue", 1);
    }

    private void click() {
        //Object value = gui.getVariable("panelVisibility");
        //gui.setVariable("panelVisibility", !(boolean) value);
    }

    private void buttonClick() {
        //gui.setVariable("ngTextValue", "myText");
    }

}
